package ink.yql.controller;

import ink.yql.service.PointService;
import ink.yql.util.RestObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/point")
public class PointController  {
    @Autowired
    private PointService pointService;
    @GetMapping("/praise/{sendTime}")
    public RestObject getByUidPraise(@PathVariable("sendTime") Long sendTime){
        // 保护措施  以防拿到url一直请求
        if (System.currentTimeMillis() / 1000 - sendTime > 3) {
            return RestObject.builder().code("400").message("请求时间超时").build();
        }
        return  pointService.getByUidPraise();
    }
    @GetMapping("/hiss/{sendTime}")
    public RestObject getByUidHiss(@PathVariable("sendTime") Long sendTime){
        // 保护措施  以防拿到url一直请求
        if (System.currentTimeMillis() / 1000 - sendTime > 3) {
            return RestObject.builder().code("400").message("请求时间超时").build();
        }
        return  pointService.getByUidHiss();
    }
}
